#include "DataStructure/Input/Constraint/RBE3Data.h"

#include "DataStructure/Common/Validation.h"

using namespace SG::DataStructure;

/// @brief 判断两个WTCG是否相等
/// @param lhs
/// @param rhs
/// @return
bool SG::DataStructure::FEM::operator== (const RBE3Data::WTCG& lhs, const RBE3Data::WTCG& rhs)
{
    if (!SG::DataStructure::Common::isNear (lhs.m_wt1, rhs.m_wt1))
    {
        return false;
    }
    if (lhs.m_c != rhs.m_c)
    {
        return false;
    }
    if (lhs.m_g != rhs.m_g)
    {
        return false;
    }
    return true;
}

/// @brief 判断两个GM是否相等
/// @param lhs
/// @param rhs
/// @return
bool SG::DataStructure::FEM::operator== (const RBE3Data::GM& lhs, const RBE3Data::GM& rhs)
{
    if (lhs.m_gm != rhs.m_gm)
    {
        return false;
    }
    if (lhs.m_cm != rhs.m_cm)
    {
        return false;
    }
    return true;
}

/// @brief 判断两个RBE3Data是否相等
/// @param lhs
/// @param rhs
/// @return
bool SG::DataStructure::FEM::operator== (const RBE3Data& lhs, const RBE3Data& rhs)
{
    if (lhs.m_id != rhs.m_id)
    {
        return false;
    }
    if (lhs.m_refg != rhs.m_refg)
    {
        return false;
    }
    if (lhs.m_domainId != rhs.m_domainId)
    {
        return false;
    }
    if (lhs.m_refc != rhs.m_refc)
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (lhs.m_tref, rhs.m_tref))
    {
        return false;
    }
    if (!SG::DataStructure::Common::isNear (lhs.m_alpha, rhs.m_alpha))
    {
        return false;
    }
    if (lhs.m_WTCG != rhs.m_WTCG)
    {
        return false;
    }
    if (lhs.m_GM != rhs.m_GM)
    {
        return false;
    }
    return true;
}
